import { datas } from './fields.js'
let that
// 串口监听
export default {
	data() {
		return {
			...datas,
			lists: []
		}
	},
	computed: {},
	onShow() {
		this.getFetchLists()
	},
	created() {
		that = this
	},
	onReady() {},
	onLoad(options) {
		that = this
	},
	methods: {
		getFetchLists() {
			uni.request({
				url: '/api/h5/getBorrowWaitList',
				method: "POST",
				header: {},
				data: {
					"userId": uni.getStorageSync('userId'),
					// "orderStatus": 0
				},
				success: (res) => {
					that.lists = res.data.data
				},
				fail: (err) => {
				}
			});
		},
		changeMenu(e) {
			that.current = e
		},
		gotoInfo(item) {
			uni.setStorageSync("userInfoAudit", item)
			uni.navigateTo({
				url: '/pages/audit/details/index?id=' + item.id
			})
		},
		cancelOrder(item) {
			let that = this
			uni.showModal({
				title: "温馨提示",
				content: "您确认要取消申请吗?",
				confirmText: "确定取消",
				success: function(res) {
					if (res.confirm) {
						// 用户点击确定操作
						uni.request({
							url: '/api/h5/deviceCancelApply',
							method: "POST",
							header: {},
							data: {
								"orderId": item.id
							},
							success: (res) => {
								that.getFetchLists()
							},
							fail: (err) => {
								console.error(err);
							}
						});
					}
				}
			})
		}
	}
}